package com.thon.service.project.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thon.dao.project.ProductDao;
import com.thon.dao.util.Page;
import com.thon.entity.project.Product;
import com.thon.service.project.ProductService;

/**
 * @file ProductServiceImpl.java
 * @author Zemo
 * @mail zemochen@gmail.com
 * @data 2013年11月21日 下午3:09:39
 * @description: TODO
 */
@Service
@Transactional
public class ProductServiceImpl implements ProductService {

	@Autowired
	private ProductDao productDao;
	@Override
	public void add(Product product) {

		productDao.save(product);
	}
	@Override
	public Page<Product> findProductByproject(int projectId, int pageNo,
			int pageSize,int isShowAll) {
		
		Page<Product> page = new Page<Product>();
		page.setPageNo(pageNo);
		page.setPageSize(pageSize);
		return productDao.findProductByProject(page, projectId,isShowAll);
	}
	@Override
	public void delete(Integer id) {
		productDao.delete(id);
	}
	@Override
	public void update(Product product) {
		productDao.update(product);
	}
	@Override
	public Product getProduct(Integer id) {
		
		return productDao.get(id);
	}
	@Override
	public List<Product> listProductByPro(int projectId) {
		return productDao.listProductsByProject(projectId);
	}

}
